<?php


namespace App\Http\Controllers\Manage\System\Dictionary;


use App\Http\Controllers\Controller;
use App\Http\Searchs\Manage\System\Dictionary\RegionSearch;
use App\Repositories\Areas;

class RegionController extends Controller
{
    /**
     * @var Areas
     * @author luffyzhao@vip.126.com
     */
    private $areas;

    /**
     * RegionController constructor.
     * @param Areas $areas
     * @author luffyzhao@vip.126.com
     */
    public function __construct(Areas $areas)
    {
        $this->areas = $areas;
    }

    /**
     * @param RegionSearch $search
     * @return \Illuminate\Http\JsonResponse
     * @author luffyzhao@vip.126.com
     */
    public function index(RegionSearch $search)
    {
        return $this->response(
            $this->areas->all($search->toArray())
        );
    }

}